package test.test1209;

import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个包含数字和字母的字符串：");
        String str = sc.nextLine();
        char[] chars = str.toCharArray();
        StringBuilder st1 = new StringBuilder();
        StringBuilder st2 = new StringBuilder();
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] >= '0' && chars[i] <= '9') {
                st1.append(chars[i]);
            } else if (chars[i] >= 'a' && chars[i] <= 'z') {
                st2.append(chars[i]);
            } else if (chars[i] >= 'A' && chars[i] <= 'Z') {
                st2.append(chars[i]);
            }
        }
        StringBuilder app = st1.append(st2);
        String s = app.toString();
        System.out.println(s);
    }
}